<!--
  User: Kuttubek Aidaraliev
  Date: 08.04.2010
  Time: 9:33:37
-->
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="../../WEB-INF/jspx/common/template.xhtml">
  <ui:define name="head">
      <title>
          <h:outputText value="#{messages.creatingRole}" rendered="#{roleBean.newEntity}"/>
          <h:outputText value="#{messages.editingRole}" rendered="#{!roleBean.newEntity}"/>
      </title>
  </ui:define>
  <ui:define name="body">
        <h:panelGroup rendered="#{roleBean.newEntity}">
            <h3 align="center"><h:outputText value="#{messages.creatingRole}" /></h3>
        </h:panelGroup>
        <h:panelGroup rendered="#{!roleBean.newEntity}">
            <h3 align="center"><h:outputText value="#{messages.editingRole}" /></h3>
        </h:panelGroup> 
        <h:form>
            <h:panelGrid columns="2">
                <ui:decorate template="../../WEB-INF/jspx/common/edit.xhtml">
                    <ui:define name="label"><h:outputText value="#{messages.title}"/></ui:define>
                    <h:inputText id="title" required="true" requiredMessage="#{messages.requiedMessage}"
                        value="#{roleBean.entity.title}"/>
                    <ui:param name="required" value="true"/>
                    <ui:param name="idInput" value="title"/>
                </ui:decorate>
            </h:panelGrid>

            <h:commandButton value="#{messages.create}" id="create" action="#{roleBeanController.inserted}"
                             rendered="#{roleBean.newEntity}" />
            <h:commandButton value="#{messages.update}" id="update" action="#{roleBeanController.updated}"
                             rendered="#{!roleBean.newEntity}"/>

        </h:form>
  </ui:define>
</ui:composition>